$(function () {
    //添加
    $("#addDialog").dialog({
        height: "auto",
        width: 500,
        autoOpen: false,
        modal: true,
        buttons: {
            "提交": function () {
                //$( this ).dialog( "close" );
                $(".load_data").show();
                $(this).attr('disabled', true);
                saveInfo();
            },
            "取消": function () {
                $(this).dialog("close");
            }

        },
        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });


    //知会记录
    $("#zhuihuiDialog").dialog({
        height: 450,
        width: 550,
        autoOpen: false,
        modal: true,
        buttons: {
          

        },
        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });




    //播放
    $("#bofangtixingDialog").dialog({
        height: "auto",
        width: 500,
        autoOpen: false,
        modal: true,
        buttons: {
            "继续观看": function () {
                //$( this ).dialog( "close" );
                $(".load_data").show();
                $(this).attr('disabled', true);
                PayContinue();

                //videoset.js
            }
        },
        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });


    $("#addw700hautoDialog").dialog({
        height: "auto",
        width: 700,
        autoOpen: false,
        modal: true,
        buttons: {
            "提交": function () {
                //$( this ).dialog( "close" );
                $(".load_data").show();
                $(this).attr('disabled', true);
                saveInfo();
            },
            "取消": function () {
                $(this).dialog("close");
            }

        },
        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });

    //删除
    $("#delDialog").dialog({
        height: "auto",
        width: 400,
        autoOpen: false,
        modal: true,
        buttons: {
            "确定": function () {
                //$( this ).dialog( "close" );
                if (selCheck()) {
                    $(".load_data").show();
                    $(this).attr('disabled', true);
                    delInfo();
                }
            },
            "取消": function () {
                $(this).dialog("close");
            }
        },
        show: {
            effect: "blind",
            duration: 10
        },
        hide: {
            effect: "explode",
            duration: 200
        }

    });

    //监控单审核
    $("#shenheDialog").dialog({
        height: 600,
        width: 700,
        autoOpen: false,
        modal: true,
        buttons: {
            
        },
        show: {
            effect: "blind",
            duration: 10
        },
        hide: {
            effect: "explode",
            duration: 200
        }

    });

    //监控单派发
    $("#paifaDialog").dialog({
        height: 600,
        width: 700,
        autoOpen: false,
        modal: true,
     
        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }
    });

    //监控单取消
    $("#cancelDialog").dialog({
        height: 600,
        width: 700,
        autoOpen: false,
        modal: true,

        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });
  




    //详情
    $("#ShowInfoDialog").dialog({
        height: 600,
        width: 700,
        autoOpen: false,
        modal: true,

        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });
  
    //添加
    $("#Dialogw600hauto").dialog({
        height: "auto",
        width: 600,
        autoOpen: false,
        modal: true,
        buttons: {
            "提交": function () {
                //$( this ).dialog( "close" );
                $(".load_data").show();
                $(this).attr('disabled', true);
                saveInfo();
            },
            "取消": function () {
                $(this).dialog("close");
            }

        },
        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });

    //详情
    $("#dialogw800hauto").dialog({
        height: "auto",
        width: 800,
        autoOpen: false,
        modal: true,

        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });


    //详情
    $("#dialog_visitproject").dialog({
        height: "auto",
        width: 800,
        autoOpen: false,
        modal: true,
        buttons: {
            "提交": function () {
                //$( this ).dialog( "close" );
                $(".load_data").show();
                $(this).attr('disabled', true);
                saveInfo();
            },
            "取消": function () {
                $(this).dialog("close");
            }

        },
        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });

    $("#addCameraDialog").dialog({
        height: "auto",
        width: 500,
        autoOpen: false,
        modal: true,
        buttons: {
            "提交": function () {
                //$( this ).dialog( "close" );
                $(".load_data").show();
                $(this).attr('disabled', true);
                saveInfo();
            },
            "取消": function () {
                $(this).dialog("close");
            }

        },
        show: {
            effect: "blind",
            duration: 500
        },
        hide: {
            effect: "explode",
            duration: 500
        }

    });




    $("#editdialog_visitproject").click(function () {
        var returnbool = selCheck();//添加时选添除 输入的内容，以免被上一次填的内容所干扰
        if (returnbool == true) {
            ShowEditMsg();//加载要编辑的信息
            $("#dialog_visitproject").dialog("open");
        }
    });



    $("#add").click(function () {

        ClearContent();//添加时选添除 输入的内容，以免被上一次填的内容所干扰
        $("#addDialog").dialog("open");
    });
    $("#addzsk").click(function () {

        ClearContent();//添加时选添除 输入的内容，以免被上一次填的内容所干扰
        $("#addw700hautoDialog").dialog("open");

    });

    $("#edit").click(function () {
         var returnbool = selCheck();//判断是否有选项
         if (returnbool == true) {
        ShowEditMsg();//加载要编辑的信息
        //$("#addDialog").dialog("open");
          }
    });


    $("#editcamera").click(function () {
        var returnbool = selCheck();//判断是否有选项
        if (returnbool == true) {
            ShowEditMsgCamerainfo();//加载要编辑的信息
            //$("#addCameraDialog").dialog("open");
        }
    });


    $("#editzsk").click(function () {
        var returnbool = selCheck();//添加时选添除 输入的内容，以免被上一次填的内容所干扰
        if (returnbool == true) {
            ShowEditMsg();//加载要编辑的信息
            $("#addw700hautoDialog").dialog("open");
        }
    });






    $("#del").click(function () {
       
        var returnbool = selCheck();//添加时选添除 输入的内容，以免被上一次填的内容所干扰
        if (returnbool == true) {
            $("#delDialog").dialog("open");
        }
    });

    $("#setPower").click(function () {
        var returnbool = selCheckSetPower();//添加时选添除 输入的内容，以免被上一次填的内容所干扰
        if (returnbool == true) {
            ShowEditMsg();//加载要编辑的信息
            $("#addDialog").dialog("open");
        }
    });


    $("#editDialogw600hauto").click(function () {
        var returnbool = selCheck();//添加时选添除 输入的内容，以免被上一次填的内容所干扰
        if (returnbool == true) {
            ShowEditMsg();//加载要编辑的信息
            $("#Dialogw600hauto").dialog("open");
        }
    });

    $("#editDialogw800hauto").click(function () {
        var returnbool = selCheck();//添加时选添除 输入的内容，以免被上一次填的内容所干扰
        if (returnbool == true) {
            ShowEditMsg();//加载要编辑的信息
            $("#dialogw800hauto").dialog("open");
        }
    });


});

function showbofangtixing() {
    
    $("#bofangtixingDialog").dialog("open");

}

//消息
function CancelDialog(itemvalue) {
    ShowCancel(itemvalue);
    $("#iframe_CanCelDialog").dialog("open");
}


function ListItem_showDetail(itemvalue) {
    ShowEditMsg(itemvalue);
    $("#DetailDialog").dialog("open");
}
//客服问卷配置
function dialogw800hauto(itemvalue) {
    Show700h800msg(itemvalue);
    $("#dialogw800hauto").dialog("open");
}
function retrunResult(respBean) {
    var code = respBean.respCode;
    var msg = respBean.respMsg;
    debugger
    //alert(msg);
    if (code == '200') {
        //
        $("#addDialog").dialog("close");
        setTimeout("window.location.reload()", 100);
    }
    else if (code == '200000') {
        alert(msg);
        $("#addDialog").dialog("close");
        setTimeout("window.location.reload()", 100);
    }
    else {
        $(".ui-button ui-corner-all ui-widget").attr('disabled', false);
        $(".load_data").hide();
        alert(msg);
    }
}



function selCheck() {
    var name = document.getElementsByName("checkBox");
    var a = 0;
    var val = "";
    for (var i = 0; i < name.length; i++) {
        if (name[i].checked) {
            if (a == 0) {
                val = name[i].value;
            } else {
                val = val + "," + name[i].value;
            }
            a++;
        }
    }
    if (a < 1) {
        alert("请至少选择一条记录");
        return false;
    }
    return true;
}


function selCheckSetPower() {
    var name = document.getElementsByName("checkBox");
    var a = 0;
    var val = "";
    for (var i = 0; i < name.length; i++) {
        if (name[i].checked) {
            if (a == 0) {
                val = name[i].value;
            } else {
                val = val + "," + name[i].value;
            }
            a++;
        }
    }
    if (a != 1) {
        alert("请选择一条记录");
        return false;
    }
    return true;
}

